package com.yjhb.android.sbz.mvp.bidding;

import com.yjhb.android.sbz.entity.BiddingUser;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;

import java.util.List;

/**
 * 创建者 zx
 * 创建时间 2020/12/18 9:09
 */
public class BiddingMorePresenter extends ConventionPresenter<BiddingMoreView> {
    private final String TAG = "BiddingMorePresenter";

    public BiddingMorePresenter(BiddingMoreView biddingMoreView) {
        super(biddingMoreView);
    }

    @Override
    protected void onDestroy() {

    }


    public void getBidList(int size, final int current) {
        HttpTool.request(model.getBidList(size, current), new HttpObserver<List<BiddingUser>>() {
            @Override
            public void onResult(List<BiddingUser> data) {
                if (view != null) {
                    if (current == 1) {
                        view.refreshList(data);
                    } else {
                        view.loadMore(data);
                    }
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });
    }
}
